<template>
    <div class="newsinfo">
        <h3 class="title">{{newsinfo.title}}</h3>
        <p class="subtitle">
            <span>发表时间:{{newsinfo.createDate|dataFormat("YYYY年MM月DD日 HH:mm:ss")}}</span>
            <span>点击:0次</span>
        </p>
        <hr>
        <div class="content" v-html="newsinfo.content">
        </div>
        <comment :nid="this.id"></comment>
    </div>
</template>
<style lang="scss">
.newsinfo{

    padding: 0 4px;
    .title{
        font-size: 16px;
        text-align: center;
        margin: 15px 0;
        color: red
    }
    .subtitle{
        font-size: 13px;
        color: #226aff;
        display: flex;
        justify-content: space-between;
    }
    .content{
        image{
            width: 100%;
        }
    }
}
</style>
<script>
import comment from "../subcomponents/comment.vue"
export default {
    data(){
        return {
            id:this.$route.params.id,
            newsinfo:{}
        }
    },
    methods:{
        getNewsInfo(){
            this.$http.get("getnewsinfo?id="+this.id).then(res=>{
                this.newsinfo=res.body.data
            })
        }
    },
    created(){
        this.getNewsInfo();
    },
    components:{
        comment:comment
    }
}
</script>